#include "dominion.h"
#include "dominion_helpers.h"
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include "rngs.h"

int checkIsGameOver(struct gameState *state) {

	int r;

	state->supplyCount[province] = 0;
	r = isGameOver(state);
	assert(r == 1);

	state->supplyCount[province] = 1;
	r = isGameOver(state);
	assert(r == 0);

	state->supplyCount[duchy] = 0;
	state->supplyCount[copper] = 0;
	state->supplyCount[curse] = 0;
	r = isGameOver(state);
	assert(r == 0);
}

int main() {

	int r, p, discardCount, handCount, deckCount;
	int k[10] = {adventurer, council_room, feast, gardens, mine, remodel, smithy, village, baron, great_hall};

	struct gameState G;

	for (p = 0; p < 2; p++) {
		for (discardCount = 0; discardCount < 10; discardCount++) {
			for (handCount = 0; handCount < 10; handCount++) {
				for (deckCount = 0; deckCount < 10; deckCount++) {
					memset(&G, 23, sizeof(struct gameState));
					r = initializeGame(2, k, 1, &G);
					G.discardCount[p] = discardCount;
					memset(&G, 0, sizeof(int) * discardCount);
					G.handCount[p] = handCount;
					memset(&G, 0, sizeof(int) * handCount);
					G.deckCount[p] = deckCount;
					memset(&G, 0, sizeof(int) * deckCount);
					checkGainCard(p, &G);
				}
			}
		}
	}
}
